%for grids method and loading data

function Fig2_a_1()
data = 48;
Fcolor='k';
Bcolor='w';
Fsize=18;  %font size

result = CS1_0_extraction_2D_Phi(data);

assignin('base','dataOneHalf',[result.az_r;result.az_phi])

%%%% plot real space %%%%
f=figure('name',['Grid:',num2str(data)]);

result.phi = (result.phi - mean(mean(result.phi)) )*1e3;
win = gausswin(201,100*2.46/2)*gausswin(201,100*2.46/2)'; %std=2nm
phi_plot = conv2(result.phi,win,'same')/sum(sum(win));

imagesc(result.rx(1,:),result.ry(:,1), phi_plot);

ax = gca;
ax.YDir='normal';ax.XDir='normal';
axis equal;axis square;
f.Color = Bcolor;ax.Color=Bcolor;
ax.XColor=Fcolor;ax.YColor=Fcolor;
xl=xlabel('X (nm)');yl=ylabel('Y (nm)');
yl.FontSize=Fsize;xl.FontSize=Fsize;
ax.FontSize=Fsize;
cMap=getColor('Magma');
colormap((cMap));
ax.CLim=[-0.8,0.5];
length_plot = 125; %from minus length to plus length(nm)
axis([-1*length_plot,length_plot,-1*length_plot,length_plot]);
end